<?php 

	if ($this->page > 1)
	{
?>
<a
	href="<?=str_replace($this->pageVar, $this->page - 1, $this->pattern);?>"
	class="next">&lt;</a>	
<?
	}

if ($this->totalPages >= 2)	
{	
	$surr = 4;
	$start = max(2, $this->page - $surr);
	$end = min($this->totalPages - 1, $this->page + $surr);
	
	$sPages = array();
	if ($start <= $end) $sPages = range($start, $end);
	
	array_unshift($sPages, 1);
	array_push($sPages, $this->totalPages);
	
	for ($i = 0; $i < sizeof($sPages); $i ++) {
	    ?>
	<a
		href="<?=str_replace($this->pageVar, $sPages[$i], $this->pattern);?>"
		<?=($sPages[$i] == $this->page ? ' class="cur"' : '');?>><?=$sPages[$i];?></a>
	<?
	    if (isset($sPages[$i + 1]) && (($sPages[$i] + 1) != $sPages[$i + 1])) {
	        ?>
	<span>&hellip;</span>
	<?
	    }
	}
	
		if ($this->totalPages > $this->page)
		{
	?>
	<a
		href="<?=str_replace($this->pageVar, $this->page + 1, $this->pattern);?>"
		class="next">></a>
	<?php 
		}
}	